package com.huanghuang.shuadan.common.exception.vaild;

import com.huanghuang.shuadan.common.exception.ExceptionEnum;
import com.huanghuang.shuadan.common.exception.base.BaseException;

/**
 * @Author suxiaoxiao
 * @Date 2019/7/14 10:52
 * @Version 1.0
 */
public class ValidException extends BaseException {

    private Valid valid;

    public ValidException(ExceptionEnum exceptionEnum) {
        super(exceptionEnum);
        valid = new Valid();
        this.valid.setExceptionEnum(exceptionEnum);
    }

    public ValidException(ExceptionEnum exceptionEnum, String fieldName) {
        super(exceptionEnum.getCode(), fieldName + exceptionEnum.getMessage());
        valid = new Valid();
        this.valid.setFieldName(fieldName);
        this.valid.setExceptionEnum(exceptionEnum);
    }

    public Valid getExceptionEnum() {
        return valid;
    }

}
